<?php
/**
 * admin service file Created by PhpStorm.
 * User: yang
 * Date: 2020/06/11
 */

namespace App\Http\Controllers\Web;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Service\Web\UserLoginService;

class UserLoginController extends Controller
{
    /**
     * 注册视图层
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function reg()
    {
        return view('Web.user.reg');
    }

    /**
     * 注册操作
     * @param Request $request
     * @return array
     */
    public function register(Request $request)
    {
        $post_data = $request->except(['_token']);

        return UserLoginService::register($post_data);
    }

    /**
     * 登录视图层
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function login()
    {
        return view('Web.user.login');
    }

    /**
     * 登录操作
     * @param Request $request
     * @return array
     */
    public function logined(Request $request)
    {
        $post_data = $request->except(['_token']);

        return UserLoginService::logined($post_data);
    }

    /**
     * 退出登录
     * @return mixed
     */
    public function logout()
    {
        return UserLoginService::logout();
    }

    /**
     * 找回密码页面
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function forget()
    {
        return view('Web.user.forget');
    }

}